// 首页子应用(首页路由)
const express = require('express')
const article = require('../middleware/article')
const category = require('../middleware/category')
const auth = require('../middleware/auth')


// 首页子应用
const searchApp = express()

// 加载首页页面
searchApp.get('/', [article.getListBykeyword,category.getList,auth.getUser], (req, res) => {
    // 渲染
    let {articles,categories,user} = req
    res.render('search', { articles: articles, categories: categories,keyword:req.query.keyword,user:user})
})

module.exports = searchApp